-
Notifications
You must be signed in to change notification settings - Fork 6k
C# language reference for records #23009
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good @tdykstra
I had a couple nits and one or two other suggestions.
Once we can see the preview site, I'll give it another look.
|
||
A record type is not necessarily immutable. You can declare properties with `set` accessors and fields that aren't `readonly`. But while records can be mutable, they are primarily intended to support immutable data models. | ||
|
||
Immutability can be useful when you need a data-centric type to be thread-safe or you're depending on a hash code remaining the same in a hash table. Immutability isn't appropriate for all data scenarios, however. Entity Framework Core 5, for example, doesn't support updating with immutable entity types. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might add that EF expects reference based equality rather than value based equality as well.
Co-authored-by: Bill Wagner <[email protected]>
Co-authored-by: Bill Wagner <[email protected]>
Co-authored-by: Bill Wagner <[email protected]>
Co-authored-by: Bill Wagner <[email protected]>
Co-authored-by: Bill Wagner <[email protected]>
Co-authored-by: Petr Kulikov <[email protected]>
Closing and reopening to trigger build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #20585